<script>
export default {
  name: "MyNav",
  data(){
    return{
        menuItem: 1
    }
  },
  props:['abc'],
  methods:{
    send(){
        this.menuItem = 5;
        //传递给父组件
      //myEvent:父组件中的自定义指令
      this.$emit('myEvent',this.menuItem);
    }
  }
}
</script>

<template>
    <div>
      <h3>我是子组件</h3>
      <p>获取到的值:{{abc}}</p>
      <button @click="send">传值给父组件</button>
    </div>
</template>

<style scoped>
  h3{
    color:blue;
  }
</style>